package train.DAT621;

public class Test621 {
    public static void main(String[] args) {
       Animal a=new Cat();
       Cat cat =new Cat();
       swimmingAble c=new Cat();

       swimmingAble d=new Dog();
       d.walk();
        c.swim();
       Animal b=new Dog();
        Animal animal = new Animal();
        //Zool zool = new Zool(animal);

        b.eat();


    }
}
interface swimmingAble{
    void swim();
    void walk();
}
  class Animal{
     public void eat(){
         System.out.println("这是无名氏");
     }

}
 class Cat extends Animal implements swimmingAble{
     @Override
     public void eat() {
         System.out.println("这是猫");
     }
     public void k(){
         System.out.println("自己的方法");
     }

     @Override
     public void swim() {
         System.out.println("猫要开始游泳啦");
     }

     @Override
     public void walk() {

     }


 }

 class Dog extends Animal implements swimmingAble{

     @Override
     public void eat() {
         System.out.println("这才是狗");

     }

     @Override
     public void swim() {

     }

     @Override
     public void walk() {
         System.out.println("狗要开始走了");
     }
 }

 class Zool {
     public Zool() { }
     public Zool(Animal animal){
         if(animal instanceof Cat){
             animal.eat();
             System.out.println("管理员正在管理猫");
         } else if(animal instanceof Dog){
             animal.eat();
             System.out.println("管理员正在管理狗");
         } else{
             animal.eat();
             System.out.println("管理员正在闲着");
         }
     }

 }
